home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / library / help / tcl / files / file < prev    next >
Encoding:
Text File  |  1993-10-26  |  5.3 KB  |  119 lines  |  [TEXT/$Tcl]

  1.  
  2.           file option name ?arg arg ...?
  3.  
  4.  
  5.      DESCRIPTION
  6.           This command provides several operations on a file's name or
  7.           attributes.  Name is the name of a file; if it starts with a
  8.           tilde, then tilde substitution is done before executing  the
  9.           command   (see  the  manual  entry  for  Tcl_TildeSubst  for
  10.           details).  Option indicates what to do with the  file  name.
  11.           Any unique abbreviation for option is acceptable.  The valid
  12.           options are:
  13.  
  14.           file atime name
  15.                Returns a decimal string giving the time at which  file
  16.                name  was  last  accessed.  The time is measured in the
  17.                standard POSIX fashion as seconds from a fixed starting
  18.                time  (often  January  1,  1970).   If the file doesn't
  19.                exist or its access time  cannot  be  queried  then  an
  20.                error is generated.
  21.  
  22.           file dirname name
  23.                Returns all of the characters in name  up  to  but  not
  24.                including  the  last  slash character.  If there are no
  25.                slashes in name then returns ``.''.  If the last  slash
  26.                in name is its first character, then return ``/''.
  27.  
  28.           file executable name
  29.                Returns 1 if file name is  executable  by  the  current
  30.                user, 0 otherwise.
  31.  
  32.           file exists name
  33.                Returns 1 if file name exists and the current user  has
  34.                search  privileges for the directories leading to it, 0
  35.                otherwise.
  36.  
  37.           file extension name
  38.                Returns all of the characters in name after and includ-
  39.                ing  the  last dot in name.  If there is no dot in name
  40.                then returns the empty string.
  41.  
  42.           file isdirectory name
  43.                Returns 1 if file name is a directory, 0 otherwise.
  44.  
  45.           file isfile name
  46.                Returns 1 if file name is a regular file, 0 otherwise.
  47.  
  48.           file lstat name varName
  49.                Same as stat option (see below) except uses  the  lstat
  50.                kernel  call  instead of stat.  This means that if name
  51.                refers to a symbolic link the information  returned  in
  52.                varName  is for the link rather than the file it refers
  53.                to.  On systems that don't support symbolic links  this
  54.                option behaves exactly the same as the stat option.
  55.  
  56.           file mtime name
  57.                Returns a decimal string giving the time at which  file
  58.                name  was  last  modified.  The time is measured in the
  59.                standard POSIX fashion as seconds from a fixed starting
  60.                time  (often  January  1,  1970).   If the file doesn't
  61.                exist or its modified time cannot be  queried  then  an
  62.                error is generated.
  63.  
  64.           file owned name
  65.                Returns 1 if file name is owned by the current user,  0
  66.                otherwise.
  67.  
  68.           file readable name
  69.                Returns 1 if file name is readable by the current user,
  70.                0 otherwise.
  71.  
  72.           file readlink name
  73.                Returns the value of the symbolic link  given  by  name
  74.                (i.e.  the  name  of  the  file it points to).  If name
  75.                isn't a symbolic link or its value cannot be read, then
  76.                an  error  is  returned.  On systems that don't support
  77.                symbolic links this option is undefined.
  78.  
  79.           file rootname name
  80.                Returns all of the characters in name  up  to  but  not
  81.                including  the  last  ``.''  character in the name.  If
  82.                name doesn't contain a dot, then returns name.
  83.  
  84.           file size name
  85.                Returns a decimal string giving the size of  file  name
  86.                in bytes.  If the file doesn't exist or its size cannot
  87.                be queried then an error is generated.
  88.  
  89.           file stat  name varName
  90.                Invokes the stat kernel call  on  name,  and  uses  the
  91.                variable  given by varName to hold information returned
  92.                from the kernel call.  VarName is treated as  an  array
  93.                variable,  and  the following elements of that variable
  94.                are set: atime, ctime,  dev,  gid,  ino,  mode,  mtime,
  95.                nlink,  size, type, uid.  Each element except type is a
  96.                decimal string with  the  value  of  the  corresponding
  97.                field  from  the  stat return structure; see the manual
  98.                entry for stat for  details  on  the  meanings  of  the
  99.                values.  The type element gives the type of the file in
  100.                the same form returned by the command file type.   This
  101.                command returns an empty string.
  102.  
  103.           file tail name
  104.                Returns all of the characters in name  after  the  last
  105.                slash.  If name contains no slashes then returns name.
  106.  
  107.           file type name
  108.                Returns a string giving the type of  file  name,  which
  109.                will  be  one  of  file,  directory,  characterSpecial,
  110.                blockSpecial, fifo, link, or socket.
  111.  
  112.           file writable name
  113.                Returns 1 if file name is writable by the current user,
  114.                0 otherwise.
  115.  
  116.  
  117.      KEYWORDS
  118.           attributes, directory, file, name, stat
  119.